#!/usr/bin/env python3.3

#
#  Filename: e34.py
#  Author  : lukas singer
#
#  Comment : Created by createSolution.sh
#

#import euler
from euler import fak

def pe34():
  print(sum(i for i in range(3,1000000) if i==sum(fak(int(str(i)[j])) for j in range(len(str(i))))))

if __name__=="__main__":
  pe34()

